<%@ include file="../confHeader.jsp" %>
<%@ include file="../mensagens.jsp" %>
<html>
<head>	
</head>
<body>
 <html:javascript formName="UsuarioForm" />  
 <html:form  action="usuarioAction.do?method=gravar" method="POST" onsubmit="return validateUsuarioForm(this);">
   <div class='pageForm'>
      <div class='formTitle'>      
	        <logic:equal value="true"  name="to" property="update" >
		          <html:hidden property="idUsuario" />
	       		<bean:message key="app.form.update"/>&nbsp;<bean:message key="user.entity"/>
	       </logic:equal>
	       <logic:notEqual value="true"  name="to"  property="update">
		       	<bean:message key="app.form.create"/>&nbsp;<bean:message key="user.entity"/>
	       </logic:notEqual>

      </div>        
        <div class='formField'>
            <label><bean:message key="user.name"/></label>
            <html:text  property="nome" size="50" maxlength="100"  />
        </div>   
        
        <div class='formField'>
            <label><bean:message key="user.login"/></label>            
           	  <html:text   property="login" size="20"   />	      
        </div>       
        <div class='formField'>
            <label><bean:message key="user.password"/></label>
            <html:password property="senha" size="10" value="" maxlength="20"/>
     	   &nbsp;
            <label><bean:message key="user.confirm.password" /></label>
            <html:password property="confirmSenha" size="10" value="" maxlength="20" />
        </div>
        
		 	${el:defineAllSearchResultsAsList('to.searcher', 'request', pageContext)}
		 	
         <div class='formField'>
            <label><bean:message key="user.role"/></label>            
             	<html:select   property="idCredencial" >
					<html:option value=""></html:option>						 	
					<logic:present name="credencialList">
					<html:options   collection="credencialList"  labelProperty="nome"  property="idCredencial" />
					</logic:present>
				</html:select>
            
        </div>
        
         <div class='formField'>
            <label><bean:message key="user.construtora"/></label>
          		<html:select  property="idConstrutora" >
					<html:option value=""></html:option>
					<logic:present  name="construtoraList">
					<html:options  collection="construtoraList" labelProperty="nome" property="idConstrutora" />
					</logic:present>
				</html:select>
            
        </div>
        
        <hr size="1">
           <div class='formButton'>  
             <a onclick="javascript:reset(UsuarioForm);" class="linkButton">  <bean:message key="app.button.reset"/></a>
      		 &nbsp;
		     <a onclick="javascript:gravar();" class="linkButton">  <bean:message key="app.button.store"/></a>
          </div>
            
    </div>
    </html:form>
   
      
<script type="text/javascript">
 // <!--
   
  var action= '<html:rewrite page="/usuarioAction.do"/>';
  var nForm =  'UsuarioForm';

 function gravar(){	 
	 executeForm(nForm, action, 'gravar');
 }
 
  //-->
</script>
</body>
</html>
